<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NINJA: NINJA/BinaryHeap.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">NINJA
   &#160;<span id="projectnumber">2.x</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_binary_heap_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">BinaryHeap.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_binary_heap_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef BINARYHEAP_HPP</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define BINARYHEAP_HPP</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_exception_handler_8hpp.html">ExceptionHandler.hpp</a>&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;cassert&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;climits&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;cstdio&gt;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="struct_int.html">   10</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_int.html">Int</a> {</div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="struct_int.html#a3f4ea8274904dcbc6a8ec0d26070cb48">   11</a></span>&#160;    <span class="keywordtype">int</span> *<a class="code" href="struct_int.html#a3f4ea8274904dcbc6a8ec0d26070cb48">pointer</a>;</div>
<div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="struct_int.html#a2894ba17eb6001ea4990dc72b54b75a8">   12</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="struct_int.html#a2894ba17eb6001ea4990dc72b54b75a8">length</a>;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;};</div>
<div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="struct_float.html">   14</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_float.html">Float</a> {</div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="struct_float.html#ae5672de8d9f917353a09fba5d2cb2931">   15</a></span>&#160;    <span class="keywordtype">float</span> *<a class="code" href="struct_float.html#ae5672de8d9f917353a09fba5d2cb2931">pointer</a>;</div>
<div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="struct_float.html#ae12c69da9c0c3c780c80a725814ffd2c">   16</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="struct_float.html#ae12c69da9c0c3c780c80a725814ffd2c">length</a>;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;};</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="class_binary_heap.html">   19</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_binary_heap.html">BinaryHeap</a> {</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <span class="comment">//constructors</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <a class="code" href="class_binary_heap.html#a7869a94b091c236c876f2446d7e51b66">BinaryHeap</a>();</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <a class="code" href="class_binary_heap.html#a7869a94b091c236c876f2446d7e51b66">BinaryHeap</a>(<span class="keywordtype">int</span> maxCapacity);</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <a class="code" href="class_binary_heap.html#a7869a94b091c236c876f2446d7e51b66">BinaryHeap</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> *val1s, <a class="code" href="struct_int.html">Int</a> keys);</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <a class="code" href="class_binary_heap.html#a7869a94b091c236c876f2446d7e51b66">BinaryHeap</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> *val1s, <a class="code" href="struct_int.html">Int</a> keys, <span class="keywordtype">int</span> maxCapacity);</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="class_binary_heap.html#a0bfd6a2f831b7d4282be2ec3838f0af5">~BinaryHeap</a>();</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_binary_heap.html#a903e4bbeaa9ca7cb7baa5a22730cd45a">size</a>() <span class="keyword">const</span>; <span class="comment">//return BinaryHeap size</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="comment">//functions</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_binary_heap.html#a146554bd398e659498861fcfbcafd645">insert</a>(<span class="keywordtype">int</span> val1, <span class="keywordtype">int</span> key) <span class="keyword">const</span>; <span class="comment">//insert element</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_binary_heap.html#a37e19e8dadb4e66fb148fed5b56aa86e">deleteMin</a>() <span class="keyword">const</span>; <span class="comment">//Remove the smallest item from the priority queue</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_binary_heap.html#a41ac81a66982236c6b0428b3f0bf14cf">isEmpty</a>() <span class="keyword">const</span>; <span class="comment">//check if empty</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_binary_heap.html#ae1d3eb2f5b4fdddcd0d4f0eda4a74ebe">makeEmpty</a>() <span class="keyword">const</span>; <span class="comment">//empty heap</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_binary_heap.html#a176296b32feaa157c1d6896ba89f7227">binHeapTest</a>(<span class="keywordtype">bool</span> verbose);</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_binary_heap.html#a33a4606314cb615739fd7fef8c8b4d10">   44</a></span>&#160;    std::vector&lt;std::pair&lt;int, int&gt; &gt; *<a class="code" href="class_binary_heap.html#a33a4606314cb615739fd7fef8c8b4d10">heap</a>;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="class_binary_heap.html#a0801f4b699bbca28d880f10c37e6abee">   46</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="class_binary_heap.html#a0801f4b699bbca28d880f10c37e6abee">DEFAULT_CAPACITY</a> = 1000;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;};</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclass_binary_heap_html_a0bfd6a2f831b7d4282be2ec3838f0af5"><div class="ttname"><a href="class_binary_heap.html#a0bfd6a2f831b7d4282be2ec3838f0af5">BinaryHeap::~BinaryHeap</a></div><div class="ttdeci">~BinaryHeap()</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:45</div></div>
<div class="ttc" id="aclass_binary_heap_html_a37e19e8dadb4e66fb148fed5b56aa86e"><div class="ttname"><a href="class_binary_heap.html#a37e19e8dadb4e66fb148fed5b56aa86e">BinaryHeap::deleteMin</a></div><div class="ttdeci">void deleteMin() const</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:57</div></div>
<div class="ttc" id="aclass_binary_heap_html_a0801f4b699bbca28d880f10c37e6abee"><div class="ttname"><a href="class_binary_heap.html#a0801f4b699bbca28d880f10c37e6abee">BinaryHeap::DEFAULT_CAPACITY</a></div><div class="ttdeci">static const int DEFAULT_CAPACITY</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:46</div></div>
<div class="ttc" id="astruct_float_html"><div class="ttname"><a href="struct_float.html">Float</a></div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:14</div></div>
<div class="ttc" id="a_exception_handler_8hpp_html"><div class="ttname"><a href="_exception_handler_8hpp.html">ExceptionHandler.hpp</a></div></div>
<div class="ttc" id="astruct_int_html"><div class="ttname"><a href="struct_int.html">Int</a></div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:10</div></div>
<div class="ttc" id="aclass_binary_heap_html_a33a4606314cb615739fd7fef8c8b4d10"><div class="ttname"><a href="class_binary_heap.html#a33a4606314cb615739fd7fef8c8b4d10">BinaryHeap::heap</a></div><div class="ttdeci">std::vector&lt; std::pair&lt; int, int &gt; &gt; * heap</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:44</div></div>
<div class="ttc" id="astruct_float_html_ae5672de8d9f917353a09fba5d2cb2931"><div class="ttname"><a href="struct_float.html#ae5672de8d9f917353a09fba5d2cb2931">Float::pointer</a></div><div class="ttdeci">float * pointer</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:15</div></div>
<div class="ttc" id="aclass_binary_heap_html_a903e4bbeaa9ca7cb7baa5a22730cd45a"><div class="ttname"><a href="class_binary_heap.html#a903e4bbeaa9ca7cb7baa5a22730cd45a">BinaryHeap::size</a></div><div class="ttdeci">int size() const</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:66</div></div>
<div class="ttc" id="aclass_binary_heap_html_ae1d3eb2f5b4fdddcd0d4f0eda4a74ebe"><div class="ttname"><a href="class_binary_heap.html#ae1d3eb2f5b4fdddcd0d4f0eda4a74ebe">BinaryHeap::makeEmpty</a></div><div class="ttdeci">void makeEmpty() const</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:70</div></div>
<div class="ttc" id="aclass_binary_heap_html"><div class="ttname"><a href="class_binary_heap.html">BinaryHeap</a></div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:19</div></div>
<div class="ttc" id="aclass_binary_heap_html_a146554bd398e659498861fcfbcafd645"><div class="ttname"><a href="class_binary_heap.html#a146554bd398e659498861fcfbcafd645">BinaryHeap::insert</a></div><div class="ttdeci">int insert(int val1, int key) const</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:50</div></div>
<div class="ttc" id="aclass_binary_heap_html_a176296b32feaa157c1d6896ba89f7227"><div class="ttname"><a href="class_binary_heap.html#a176296b32feaa157c1d6896ba89f7227">BinaryHeap::binHeapTest</a></div><div class="ttdeci">static bool binHeapTest(bool verbose)</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:75</div></div>
<div class="ttc" id="astruct_int_html_a3f4ea8274904dcbc6a8ec0d26070cb48"><div class="ttname"><a href="struct_int.html#a3f4ea8274904dcbc6a8ec0d26070cb48">Int::pointer</a></div><div class="ttdeci">int * pointer</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:11</div></div>
<div class="ttc" id="astruct_float_html_ae12c69da9c0c3c780c80a725814ffd2c"><div class="ttname"><a href="struct_float.html#ae12c69da9c0c3c780c80a725814ffd2c">Float::length</a></div><div class="ttdeci">int length</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:16</div></div>
<div class="ttc" id="aclass_binary_heap_html_a41ac81a66982236c6b0428b3f0bf14cf"><div class="ttname"><a href="class_binary_heap.html#a41ac81a66982236c6b0428b3f0bf14cf">BinaryHeap::isEmpty</a></div><div class="ttdeci">bool isEmpty() const</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:62</div></div>
<div class="ttc" id="aclass_binary_heap_html_a7869a94b091c236c876f2446d7e51b66"><div class="ttname"><a href="class_binary_heap.html#a7869a94b091c236c876f2446d7e51b66">BinaryHeap::BinaryHeap</a></div><div class="ttdeci">BinaryHeap()</div><div class="ttdef"><b>Definition:</b> BinaryHeap.cpp:13</div></div>
<div class="ttc" id="astruct_int_html_a2894ba17eb6001ea4990dc72b54b75a8"><div class="ttname"><a href="struct_int.html#a2894ba17eb6001ea4990dc72b54b75a8">Int::length</a></div><div class="ttdeci">int length</div><div class="ttdef"><b>Definition:</b> BinaryHeap.hpp:12</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_994258571ff4fe75827c48a736f217ad.html">NINJA</a></li><li class="navelem"><a class="el" href="_binary_heap_8hpp.html">BinaryHeap.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
  </ul>
</div>
</body>
</html>
